<?php
require_once('tpl/head.php');
include_once('./system/dbConn.php');
connect();
//接受，sql，更新点击量
$vid=$_GET["vid"];
$sql="select * from videos join videotype on videos.tid=videotype.tid join admins on videos.upoadadmin=admins.adminid where vid=$vid";
$result=mysql_query($sql);
$row=mysql_fetch_assoc($result);
//更新点击次数
$sqlhit="update videos set hittimes=hittimes+1 where vid=$vid";
$resulthit=mysql_query($sqlhit);
?>
<!-- /登录模态框开始 -->
<div class="modal fade" id="login1" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">用户登录</h4>
        <form action="doUserLogin.php" method="post">
        <input type="hidden" name="vid" value="<?php echo $vid; ?>">
        <div class="form-group">
    <label for="inputName" class="col-md-2 control-label">用户名</label>
    <div class="col-md-10">
      <input type="text" class="form-control" id="inputName" placeholder="用户名" name="username">
    </div>
  </div>



  <div class="form-group">
    <label for="inputPassword3" class="col-md-2 control-label">密码</label>
    <div class="col-md-10">
      <input type="password" class="form-control" id="inputPassword3" placeholder="密码" name="password">
    </div>
  </div>
        <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
    <input type="submit" class="btn btn-default" value="登录">
    
    </div>
  </div>

        </form>
      </div>
      <div class="modal-body">

    




      </div>
      <div class="modal-footer">
                <button type="button" class="btn btn-default" onclick="location.replace('index.php')" data-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>  
<!-- /登录模态框结束 -->


<div class="container">

    <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-12">


            <div class="row box">
                <div class="col-lg-4 text-center">
                <video controls poster="../posters/<?php echo $row["pic"] ?>" height="200" width="300">
                     <source src="./video/1.mp4" type="video/mp4">
      
                </video> 

                   <!-- <img src="./posters/<?php echo $row["pic"]; ?>" width="270" height="300" class="responsive img-thumbnail"/> -->
                    
                    <p><?php echo $row["videoname"]; ?></p>

                </div><!--放视频海报和标题-->
                <div class="col-lg-8 text-center">
                <table class="table table-hover">
                    <tr>
                        <td>专栏</td>
                        <td><?php echo $row["typename"]; ?></td>
                    </tr>
                    <tr>
                        <td>上传时间</td>
                        <td><?php echo $row["uploaddate"]; ?></td>
                    </tr>

                    <tr>
                        <td>点击次数</td>
                        <td><?php echo $row["hittimes"]; ?></td>
                    </tr>

                    <tr>
                        <td>上传人</td>
                        <td><?php echo $row["adminname"]; ?></td>
                    </tr>

                    <tr>
                        <td>有事找站长</td>
                        <td><a href="mailto:1261475895@qq.com">意见箱</a></td>
                    </tr>
                    <tr>
                        <td>评分</td>
                        <td></td>
                    </tr>

                </table>


                </div><!--表格显示视频详细信息-->


            </div>
            <!--/row-->
            <div class="row box">

                <div class="col-lg-12">
                    <h2 class="intro-text text-center">内容简介

                    </h2>
                    <?php echo $row["intro"]; ?>


                </div>
            </div>  <!--/row-->

            
            <div class="row box">

                <div class="col-lg-12">
                    <h2 class="intro-text text-center">留言列表

                    </h2>
                    <?php 
                    $sql0="select * from comments where vid=$vid";
                    $result0=mysql_query($sql0);?>
                    
                        
                    <table class="table table-hover" align="center" width="60%">
                        <tr>
                            <th>序号</th>
                            <th>评论内容</th>
                            <th>评论人</th>
                            <th>发表评论的时间</th>
                        </tr>
                        <?php  
                        while ( $row0=mysql_fetch_assoc($result0)) {?>
                        <tr>
                            <td><?php echo $row0["cid"]; ?></td>
                            <td><?php echo $row0["content"]; ?></td>
                            <td><?php $uid=$row0["uid"];
                            $sql2="select uname from users where uid=$uid";
                            $result2=mysql_query($sql2);
                            $row2=mysql_fetch_assoc($result2);
                            echo $row2["uname"] ?></td>
                            <td><?php echo $row0["cdate"]; ?></td>
                        </tr>
                           <?php  
}
                     ?>

                    </table>
                 

                </div>
            </div>  <!--/row-->
                <div class="row box">

                <div class="col-lg-12">
                    <h2 class="intro-text text-center">留言

                    </h2>
                    <form class="form-horizontal" action="doCommentAdd.php" method="post" enctype="multipart/form-data">
                    <input type="hidden" name="vid" value="<?php echo $row["vid"]; ?>">

                      <div class="form-group">
    
                      <div class="col-md-12">
                      <textarea  class="form-control" name="content" rows="3">
                          
                      </textarea>
                      <?php 
                        
                          if (isset($_SESSION["username"])) {
                               echo "";
                           }
                           else{
                            echo "您还未登录，请"."<a href='#' data-toggle='modal' data-target='#login1'>登录</a>";
                            } ?>
                      </div>
                      </div>

                      <div class="form-group">
                      <div class=" col-md-12">
                       <input type="submit" class="btn btn-default" value="发表留言">
                      </div>
                     </div>
                    </form>



                </div>
            </div>  <!--/row-->


        </div>
        <!--/.col-xs-12.col-sm-12-->

       
    </div>
    <!--/row-->

    

</div>
<!--/.container-->
<?php
require_once('tpl/foot.php');
include_once('./system/dbConn.php');
?>
